package photo_upload;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

public class MultiUploadUsingArrayAction extends ActionSupport {
	private File[] upload;
	private String[] uploadFileName;
	private String[] uploadContentType;
	private String[] serverFullPath;  

    public String execute() throws Exception {
		String basePath = getText("path.upload_file");
		
		FileService fileService = new FileService();
		
		serverFullPath = new String[upload.length];
		for (int i=0; i<upload.length; i++) {
			serverFullPath[i] = fileService.saveFile(upload[i], basePath, uploadFileName[i]);
		}
		
        return SUCCESS;
    }

	public File[] getUpload() {
		return upload;
	}
	public void setUpload(File[] upload) {
		this.upload = upload;
	}
	public String[] getUploadContentType() {
		return uploadContentType;
	}
	public void setUploadContentType(String[] uploadContentType) {
		this.uploadContentType = uploadContentType;
	}
	public String[] getUploadFileName() {
		return uploadFileName;
	}
	public void setUploadFileName(String[] uploadFileName) {
		this.uploadFileName = uploadFileName;
	}
	public String[] getServerFullPath() {
		return serverFullPath;
	}
	public void setServerFullPath(String[] serverFullPath) {
		this.serverFullPath = serverFullPath;
	}
}
